<!--attach标签的渲染方式-->
<script setup>

const props = defineProps({
  text: {type: String},
})

const pattern = /filename=(.+?)$/

// 链接地址
const getHref = (t) => {
  return '/attachments' + t.substring(1)
}
// 链接标题
const getTitle = (t) => {
  const matcher = pattern.exec(t)
  if (matcher) {
    return decodeURI(matcher[1])
  }
  return undefined
}


</script>

<template>
  <el-link :dowload="getTitle(text)" :href="getHref(text)" target="_blank">下载附件
    <span v-if="getTitle(text)">: {{ getTitle(text) }}</span>
  </el-link>
</template>

<style scoped>

</style>